using System;
using System.Collections.Generic;
using System.Text;
using System.Collections;
using System.IO;

namespace KiemBao
{
    class Node
    {
        public double G
        {
            get
            {
                return this.m_fG;
            }
            set
            {
                this.m_fG = value;
            }
        }
        public int LABEL
        {
            get
            {
                return this.m_iLabel;
            }
            set
            {
                this.m_iLabel = value;
            }
        }
        public string NAME
        {
            get
            {
                return this.m_strID;
            }
            set
            {
                this.m_strID = value;
            }
        }
        public Node PREVIOUS
        {
            get
            {
                return this.m_nPreviousNode;
            }
            set
            {
                this.m_nPreviousNode = value;
            }
        }
        public ArrayList SUCCESS
        {
            get
            {
                return this.m_arrSuccess;
            }
            set
            {
                this.m_arrSuccess = value;
            }
        }
        public float X
        {
            get
            {
                return this.m_iX;
            }
            set
            {
                this.m_iX = value;
            }
        }
        public float Y
        {
            get
            {
                return this.m_iY;
            }
            set
            {
                this.m_iY = value;
            }
        }
        private Node m_nPreviousNode;
        private ArrayList m_arrSuccess;
        private double m_fG;
        private int m_iLabel;
        private float m_iX;
        private float m_iY;
        private string m_strID;
        public Node()
        {
            this.LABEL = -1;
            this.SUCCESS = new ArrayList();
            this.SUCCESS = null;
            this.PREVIOUS = null;
            this.G = 0.0;
        }
        public Node(float fX, float fY, string strID)
        {
            this.X = fX;
            this.Y = fY;
            this.NAME = strID;
            this.LABEL = -1;
            this.SUCCESS = null;
            this.PREVIOUS = null;
            this.G = 0.0;
        }

        public double Cost(Node S)
        {
            return Math.Sqrt(Math.Pow((double)(S.X - this.X), 2.0) + Math.Pow((double)(S.Y - this.Y), 2.0));
        }

        public static ArrayList NodeNull(ArrayList arrQ)
        {
            ArrayList list = new ArrayList();
            foreach (Node state in arrQ)
            {
                state.LABEL = -1;
                state.PREVIOUS = null;
                state.G = 0.0;
                list.Add(state);
            }
            return list;
        }

        public static Node Previous(Node State)
        {
            return State.PREVIOUS;
        }















































    }
}
